import QtQuick 2.5
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
import ".."

Popup
{
    id: myLoadingView
    height: 600
    width: 1024
    property string text: "正在等待..." +
                          TaskBridge.trackProg + " / " + TaskBridge.trackTotal
    background: Rectangle
    {
        color: Qt.rgba(0.8, 0.8, 0.8, 0.6)
    }
    MyRectangle
    {
        height: 200
        width: 400
        anchors.centerIn: parent
        Item
        {
            id: maskLoading
            height: 50
            width: 50
            anchors.centerIn: parent
            Rectangle
            {
                id: rect
                width: parent.width
                height: parent.height
                color: Common.colorTransParent
                radius: width / 2
                border.width: width / 6
                visible: false
            }

            ConicalGradient
            {
                width: rect.width
                height: rect.height
                gradient: Gradient
                {
                    GradientStop{ position: 0.0; color: Common.colorMain }
                    GradientStop{ position: 1.0; color: Common.colorInvalid }
                }
                source: rect
                Rectangle
                {
                    anchors.top: parent.top
                    anchors.horizontalCenter: parent.horizontalCenter
                    width: rect.border.width
                    height: width
                    radius: width / 2
                    color: Common.colorMain
                }

                RotationAnimation on rotation
                {
                    from: 0
                    to: 360
                    duration: 1000
                    loops: Animation.Infinite
                }
            }
        }
        Text
        {
            anchors.top: maskLoading.bottom
            anchors.topMargin: 20
            anchors.horizontalCenter: parent.horizontalCenter
            font.family: Common.fontMain
            font.pixelSize: 16
            color: Common.colorText
            text: myLoadingView.text
        }
    }
}
